package com.hdsx.jxcsxm.funds.server.impl;

import com.hdsx.dao.query.base.BaseOperate;
import com.hdsx.jxcsxm.funds.bean.FundBean;
import com.hdsx.jxcsxm.funds.bean.ProcessorBean;
import com.hdsx.jxcsxm.funds.bean.ProcessorParam;
import com.hdsx.jxcsxm.funds.server.FundServer;
import com.hdsx.jxcsxm.shares.bean.JhxdwhBean;
import com.hdsx.jxcsxm.tjbb.bean.Excel_list;
import com.hdsx.jxcsxm.xtgl.bean.TreeNode;
import com.hdsx.jxcsxm.xtgl.bean.Xmjbxx;
import com.hdsx.jxcsxm.zjbf.bean.XmZjbf;
import com.hdsx.jxcsxm.zjdw.bean.XmZjdw;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author 占贤银
 * time 2024/2/2 11:01
 * description 生命之灯因热情而点燃，生命之舟因拼搏而前行
 */
@Service
public class FundServerImpl extends BaseOperate implements FundServer {

    public FundServerImpl() {
        super("funds", "jdbc");
    }

    @Override
    public List<FundBean> queryXmlist(FundBean fundBean) {
        return queryList("queryXmlist", fundBean);
    }

    @Override
    public List<FundBean> queryZjdwXmlist(FundBean fundBean) {
        return queryList("queryZjdwXmlist", fundBean);
    }

    @Override
    public int queryXmlistCount(FundBean fundBean) {
        return queryOne("queryXmlistCount", fundBean);
    }

    @Override
    public int queryZjdwXmlistCount(FundBean fundBean) {
        return queryOne("queryZjdwXmlistCount", fundBean);
    }

    @Override
    public FundBean getxmInfo(FundBean fundBean) {
        return queryOne("getxmInfo", fundBean);
    }

    @Override
    public List<FundBean> queryzjxdlist(FundBean fundBean) {
        return queryList("queryzjxdlist", fundBean);
    }

    @Override
    public int queryzjxdlistCount(FundBean fundBean) {
        return queryOne("queryzjxdlistCount", fundBean);
    }

    @Override
    public FundBean getdwTj(FundBean fundBean) {
        return queryOne("getdwTj", fundBean);
    }

    @Override
    public FundBean getTjAll(FundBean fundBean) {
        return queryOne("getTjAll", fundBean);
    }

    @Override
    public FundBean getZjdwTjAll(FundBean fundBean) {
        return queryOne("getZjdwTjAll", fundBean);
    }

    @Override
    public FundBean getJhxdByWh(FundBean fundBean) {
        return queryOne("getJhxdByWh", fundBean);
    }

    @Override
    public FundBean getbfTj(FundBean fundBean) {
        return queryOne("getbfTj", fundBean);
    }

    @Override
    public List<JhxdwhBean> getFundjhxdwh(FundBean fundBean) {
        return queryList("getFundjhxdwh", fundBean);
    }

    @Override
    public List<Excel_list> exportXmList(FundBean fundBean) {
        return queryList("exportXmList", fundBean);
    }

    @Override
    public List<XmZjdw> queryzjdwmb(Xmjbxx xmjbxx) {
        return queryList("queryzjdwmb",xmjbxx);
    }

    @Override
    public List<XmZjbf> queryzjbfmb(Xmjbxx xmjbxx) {
        return queryList("queryzjbfmb", xmjbxx);
    }

    @Override
    public boolean importZjbf(List<Map> data) {
        for(Map m:data) {
            Map lm=queryOne("getWhByImp", m);
            if(lm!=null)
                if(!"0".equals(lm.get("ISXMBM").toString()) && "0".equals(lm.get("ISXMBMANDWH").toString())) {
                    m.put("10", lm.get("WH"));
                }
        }
        return insertBatch("importZjbf", data)==data.size();
    }

    @Override
    public boolean importZjdw(List<Map> data) {
        for (Map map : data) {
            Map lm=queryOne("getWhByImp", map);
            if(lm!=null) {
                if(!"0".equals(lm.get("ISXMBM").toString()) && "0".equals(lm.get("ISXMBMANDWH").toString())) {
                    map.put("10", lm.get("WH"));
                }
            }
        }
        return insertBatch("importZjdw", data)==data.size();
    }

    @Override
    public XmZjdw queryZjdwDataByXmid(Map map) {
        return queryOne("queryZjdwDataByXmid", map);
    }

    @Override
    public List<ProcessorBean> queryjhDataBybgDel(FundBean param) {
        return queryList("queryjhDataBybgDel", param);
    }

    @Override
    public int queryjhDataBybgDelCount(FundBean fundBean) {
        return queryOne("queryjhDataBybgDelCount", fundBean);
    }

    @Override
    public List<TreeNode> getJsxzTreeByName() {
        return queryList("getJsxzTreeByName");
    }
}
